﻿// /////////////////////////////////////////////////////////////////////
// 
//  Codeplex JSAnalyse
//  Copyright (c) 2011
//  JSAnalyse.Test   AllowedDependenciesTest.cs
// 
// /////////////////////////////////////////////////////////////////////
using System.Collections.Generic;
using System.Linq;
using JSAnalyse.Core.Interfaces;

namespace JSAnalyse.Test.Helper
{
    public class AllowedDependenciesTest: IAllowedDependencies
    {

        // todo: create base class in core 
        private readonly List<AllowedDependencyTest> _allowedDependencyList;

        public AllowedDependenciesTest(List<AllowedDependencyTest> allowedDependencyList)
        {
            _allowedDependencyList = allowedDependencyList;
        }

        public bool IsAllowed(string file, string dependencyFile)
        {
            return _allowedDependencyList.FirstOrDefault(item => item.SourceFile == file && item.TargetFile == dependencyFile) != null;
        }
    }
}
